<form class="dark_form" method="post" action="<?php echo $action ?>" enctype="multipart/form-data">
    <?php if($photo_upload === TRUE) : ?>
    <div class="field">
        <div class="ilabel">File to upload</div>
        <div class="iinput">
            <input type="file" name="file" class="ifile" id="profpic" accept="image/bmg,image/png,image/jpeg,image/jpg" onchange="validateProfPic()"/>
            <div class="ireq">bmp, jpg, jpeg, png only.</div>
        </div>
        <div class="iinfo" id="profpic_info"></div>
    </div>
    <?php endif;?>
    <div class="field">
        <div class="ilabel">Description</div>
        <div class="iinput">
            <input type="text" name="description" class="itext" id="desc" onchange="validateDesc()" value="<?php echo $photo->description; ?>"/>
            <div class="ireq">Min. 5 characters.</div>
        </div>
        <div class="iinfo" id="desc_info"></div>
    </div>
    <div class="field">
        <div class="ilabel">Keyword</div>
        <div class="iinput">
            <input type="text" name="keyword" class="itext" id="keyword" onchange="validateKeyword()" value="<?php echo $photo->keyword; ?>"/>
            <div class="ireq">Min. 3 characters.</div>
        </div>
        <div class="iinfo" id="keyword_info"></div>
    </div>
    <div class="field">
        <div class="ilabel">Date Taken</div>
        <div class="iinput">
            <input type="text" name="date_pick" class="itext" id="date_taken" onchange="validateBirthdate()" value="<?php echo $photo->date_pick; ?>"/>
            <input type="button" class="ical" onclick="openCalPhoto()" value="calendar"/>

            <!-- CALENDAR -->
            <div class="floatcal" id="floatcalPhoto">
                <script type="text/javascript">
                    //<![CDATA[
                    var calPhoto = new Calendar(
                        new Date(),
                        document.getElementById("floatcalPhoto"),
                        "calPhoto",
                        function(date){
                            var yyyy = "" + date.getFullYear();
                            while(yyyy.length < 4) yyyy = "0" + yyyy;
                            var mm = "" + (date.getMonth() + 1);
                            while(mm.length < 2) mm = "0" + mm;
                            var dd = "" + date.getDate();
                            while(dd.length < 2) dd = "0" + dd;
                            document.getElementById('date_taken').value = yyyy + "-" + mm + "-" + dd;
                            openCalPhoto();
                            validateDateTaken();
                        }
                    );

                    function openCalPhoto() {
                        if(calPhoto.isVisible) calPhoto.hideCalendar();
                        else calPhoto.drawCalendar();
                    }
                    //]]>
                </script>
            </div>

            <div class="ireq">YYYY-MM-DD</div>
        </div>
        <div class="iinfo" id="date_taken_info"></div>
    </div>
    <?php if($tag == TRUE) : ?>
    <div class="field">
        <div class="ilabel">Tag</div>
        <div class="iinput">
            <input type="text" name="inline_tag" class="itext" id="desc" value="<?php echo $inline_tag; ?>"/>
        </div>
        <div class="iinfo" id="desc_info"></div>
    </div>
    <?php endif; ?>
    <div class="field">
        <div class="ilabel">Category</div>
        <div class="iinput">
            <select name="category_id">
                <?php foreach ($category as $c) : ?>
                <option <?php echo ($c->id == $photo->category_id) ? "selected" : "" ?> value="<?php echo $c->id; ?>">
                    <?php echo $c->name; ?>
                </option>
                <?php endforeach; ?>
            </select>
        </div>
        <div class="iinfo"></div>
        </div>
        <div class="field">
            <div class="ilabel">View Access</div>
            <div class="iinput">
                <select name="view_access">
                <?php foreach ($access as $ac) : ?>
                        <option <?php echo ($ac->id == $photo->view_access) ? "selected" : "" ?> value="<?php echo $ac->id; ?>">
                    <?php echo $ac->description; ?>
                    </option>
                <?php endforeach; ?>
            </select>
        </div>
        <div class="iinfo"></div>
    </div>
    <div class="field">
        <div class="ilabel">Comment Access</div>
        <div class="iinput">
            <select name="comment_access">
                <option <?php echo ($photo->comment_access == 0) ? "selected" : "" ?> value="0">Enable</option>
                <option <?php echo ($photo->comment_access == 1) ? "selected" : "" ?> value="1">Disable</option>
            </select>
        </div>
        <div class="iinfo"></div>
    </div>
    <div class="subm_wrap">
        <input type="submit" class="isubmit" name="add_photo" onclick="return validatePhotoUpload()" value="<?php echo $button_name; ?>"/>
    </div>
</form>

<div id ="fb-root"></div>